<?php
class Model
{
    /**
     * The table column names derived from SQL DESCRIBE.
     *
     * @var array
     */
    protected $_cols;


    /**
     * The primary key column or columns.
     * A compound key should be declared as an array.
     * You may declare a single-column primary key
     * as a string.
     *
     * @var mixed
     */
    protected $_primary = null;

    /**
     * The table name.
     *
     * @var string
     */
    protected $_name = null;

	public function __construct()
	{
		$this->_setupTableName();
	}

    /**
     * Inserts a new row.
     *
     * @param  array  $data  Column-value pairs.
     * @return mixed         The primary key of the row inserted.
     */
	public function insert(array $data)
	{
		
	}

    /**
     * Updates existing rows.
     *
     * @param  array        $data  Column-value pairs.
     * @param  array|string $where An SQL WHERE clause, or an array of SQL WHERE clauses.
     * @return int          The number of rows updated.
     */
	public function update(array $data, $where)
	{
		
	}

    /**
     * Deletes existing rows.
     *
     * @param  array|string $where SQL WHERE clause(s).
     * @return int          The number of rows deleted.
     */
	public function delete($where)
	{
		
	}

    /**
     * Load a single row by primary key
     *
     * @param  array|string $where SQL WHERE clause(s).
     * @return int          The primary key of the row to load or an array in a table with a multi-column primary key
     */
	public function load($primary_key)
	{
		
	}

    /**
     * Fetches all rows.
     *
     * @param string|array                      $where  OPTIONAL An SQL WHERE clause.
     * @param string|array                      $order  OPTIONAL An SQL ORDER clause.
     * @param int                               $count  OPTIONAL An SQL LIMIT count.
     * @param int                               $offset OPTIONAL An SQL LIMIT offset.
     * @return ????????????????????????
     */
    public function fetchAll($where = null, $order = null, $count = null, $offset = null)
    {
	}

    /**
     * Initialize table and schema names.
     *
     * If the table name is not set in the class definition,
     * use the class name itself as the table name.
     *
     * A schema name provided with the table name (e.g., "schema.table") overrides
     * any existing value for $this->_schema.
     *
     * @return void
     */
    protected function _setupTableName()
    {
        if (! $this->_name)
		{
            $this->_name = get_class($this);
        }
    }
}
?>